//LiuZh 2017-07-02
import React, { Component } from 'react';

import {
  View,
  Image,
  Text,
  StyleSheet,
  Dimensions,
  TouchableWithoutFeedback
} from 'react-native';


import Constant from 'shequnsiweiapp/src/core/constant/Constant'

let baseUrl = Constant.serverUrl;
let freeImg = require('../../../img/free.png');
let needBuyImg  = require('../../../img/needbuy.png');
let winWidth  = Dimensions.get('window').width;//屏幕宽度

export default class KcjjItem extends Component{
	render() {
		let data = this.props.data;
		return(
			<TouchableWithoutFeedback
				onPress={() => {this.props.onPress(data)}}>
				<View style={styles.body}>
					<Image style={styles.img}
						resizeMode={'contain'}
						source={{uri:baseUrl + data.IMAGE_}}/>
					<View style={styles.rightBody}>
						<View style={{flex: 1,flexDirection: 'row'}}>
							<Text style={styles.txtTitle}
								numberOfLines={1}>{data.TITLE1}</Text>
							<Image style={styles.imgTip}
								resizeMode={'contain'}
								source={data.FREE_ == 1 ? freeImg : needBuyImg}/>
						</View>
						<View style={{flex: 1}}>
							<Text style={styles.txtContent}
								numberOfLines={1}>{data.TITLE2}</Text>
						</View>
					</View>
				</View>
			</TouchableWithoutFeedback>
	)}

}

const styles = StyleSheet.create({
	body: {
		height: 100,
		width: winWidth,
		backgroundColor: '#FFF',
		marginBottom: 1,
		padding: 10,
		flexDirection: 'row',
	},
	img: {
		height: 80,
		width: 100,
	},
	rightBody: {
		marginLeft: 2,
		flex: 1,
	},
	txtTitle: {
		fontSize: 14.3,
		color: '#555',
		flex: 1
	},
	imgTip: {
		height: 16,
		width: 30,
	},
	txtContent: {
		marginRight: 30,
	}
})